<template>
  <div :style="{height: '100vh'}">
    <a-skeleton :loading="loading">
      <DocumentEditor
          v-if="data?.code === 0"
          id="docxEditor"
          :documentServerUrl="data?.data.server_address"
          :config="data?.data.config"
      />
    <a-result
        v-else
        status="warning"
        :title="data?.msg"
    />
    </a-skeleton>
  </div>
</template>

<script setup>
import {DocumentEditor} from "@onlyoffice/document-editor-vue";
// import './style.css'
import {useRequest} from "ahooks-vue";
import {ApiOfficeConfig} from "@/api/FileLibrary.js";
import {useRoute} from "vue-router";

const route = useRoute();
const filePath = route.query.filePath


const {data, run, loading} = useRequest(ApiOfficeConfig, {defaultParams: [{raw_path: filePath}]})

</script>